package com.markerhub.common.enums;

/**
 * @description:
 * @projectName: vueadmin-java
 * @author: zhouhaizhi
 * @createTime: 2021/9/22 13:51
 * @version:1.0
 */
public enum HealthcodeStateEnums {

    GREEN("G", "绿码"),
    YELLOW("Y","黄码"),
    RED("R","红码"),
    NO("O","无法识别");

    private String code;

    private String name;

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    HealthcodeStateEnums(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public static HealthcodeStateEnums getHealthcodeStateByCode(String code) {
        HealthcodeStateEnums[] arr = HealthcodeStateEnums.values();
        for (HealthcodeStateEnums healthcodeStateEnums : arr) {
            if (healthcodeStateEnums.getCode().equals(code)) {
                return healthcodeStateEnums;
            }
        }
        return null;
    }

    public static String getNameByCode(String code){
        HealthcodeStateEnums healthcodeStateEnums = getHealthcodeStateByCode(code);
        if (null != healthcodeStateEnums) {
            return healthcodeStateEnums.getName();
        }
        return null;
    }

}
